package android.support.v4.os;

import android.content.Context;

import com.example.utils.Logger;

public class EContextImpl extends EHook {
	static final Logger log = Logger.create("contextImpl");

	private enum Methods {
		getPackageManager, 
		getSystemService
	};

	
	@Override
	public String getClassName() {
		return "android.app.ContextImpl";
	}

	@Override
	public void hook() {
		findAndHookMethod(Methods.getSystemService.name(), String.class, this);
	}
	
	private void handleGetSystemService(String name, Object instance) {
		log.i("getSystemService:" + name);
		
		if (name.equals(Context.TELEPHONY_SERVICE)) {
			
		}
	}

	@Override
	protected void after(String name, Object[] args, MethodHookParam param) {
		Object instance = param.getResult();
		log.i("after " + name + ", ret " + instance);

		if(name.equals(Methods.getSystemService.name())) {
			handleGetSystemService((String) args[0], instance);
		}
	}
}
